package com.st.controller;

import com.api.attractions.IAttractionsClient;
import com.st.entity.*;
import com.st.service.IAttractionsService;
import com.st.service.IContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/content")
public class ContentController {
    @Autowired
    private IContentService iContentService;
    @Autowired
    private IAttractionsService iAttractionsService;
    //查询景点
    @RequestMapping("/findAll")
    public List<Attractions> findAll(){
        return iAttractionsService.findAll1();
    }
    //查询所有内容
    @RequestMapping("/search")
    public PageResult<Content> searchAll(@RequestBody PageDTO<Content> pageDTO){
        return iContentService.search(pageDTO);
    }
    //添加修改内容
    @RequestMapping("/addContent")
    public Result addContent(@RequestBody Content content){
        return iContentService.addContent(content);
    }
    //删除内容
    @RequestMapping("/delContent")
    public Result delContent(@RequestBody Content content){
        return iContentService.delContent(content);
    }
}
